VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.1#0"; "MSCOMCTL.OCX"
Object = "{61772A0D-1B9C-47EF-823B-2EDB483C3315}#1.0#0"; "Toolbar3.ocx"
Object = "{3FE3788B-5CEC-41C5-BE42-64D5CB841267}#3.0#0"; "MyXPMenu6.ocx"
Begin VB.MDIForm MDIForm1 
   BackColor       =   &H8000000C&
   Caption         =   "Accountant"
   ClientHeight    =   7440
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   13245
   Icon            =   "MDIForm1.frx":0000
   LinkTopic       =   "MDIForm1"
   StartUpPosition =   3  'Windows Default
   WindowState     =   2  'Maximized
   Begin MSComctlLib.StatusBar StatusBarMDI 
      Align           =   2  'Align Bottom
      Height          =   375
      Left            =   0
      TabIndex        =   2
      Top             =   7065
      Visible         =   0   'False
      Width           =   13245
      _ExtentX        =   23363
      _ExtentY        =   661
      _Version        =   393216
      BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628} 
         NumPanels       =   1
         BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            AutoSize        =   1
            Object.Width           =   22834
         EndProperty
      EndProperty
   End
   Begin VB.Timer Timer1 
      Enabled         =   0   'False
      Interval        =   100
      Left            =   7320
      Top             =   2760
   End
   Begin MSComctlLib.ImageList ImageList1 
      Left            =   4080
      Top             =   3360
      _ExtentX        =   1005
      _ExtentY        =   1005
      BackColor       =   -2147483643
      ImageWidth      =   16
      ImageHeight     =   16
      MaskColor       =   12632256
      _Version        =   393216
      BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
         NumListImages   =   10
         BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "MDIForm1.frx":1CCA
            Key             =   ""
         EndProperty
         BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "MDIForm1.frx":3D9F
            Key             =   ""
         EndProperty
         BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "MDIForm1.frx":5E6A
            Key             =   ""
         EndProperty
         BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "MDIForm1.frx":8065
            Key             =   ""
         EndProperty
         BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "MDIForm1.frx":A30E
            Key             =   ""
         EndProperty
         BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "MDIForm1.frx":C5BC
            Key             =   ""
         EndProperty
         BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "MDIForm1.frx":E7C1
            Key             =   ""
         EndProperty
         BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "MDIForm1.frx":1097B
            Key             =   ""
         EndProperty
         BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "MDIForm1.frx":12BEB
            Key             =   ""
         EndProperty
         BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "MDIForm1.frx":15ABA
            Key             =   ""
         EndProperty
      EndProperty
   End
   Begin MSComctlLib.Toolbar Toolbar1 
      Align           =   1  'Align Top
      Height          =   1740
      Left            =   0
      TabIndex        =   1
      Top             =   375
      Width           =   13245
      _ExtentX        =   23363
      _ExtentY        =   3069
      ButtonWidth     =   2566
      ButtonHeight    =   1005
      Appearance      =   1
      Style           =   1
      ImageList       =   "ImageList1"
      _Version        =   393216
      BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
         NumButtons      =   13
         BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Caption         =   "Login"
            Object.ToolTipText     =   "Login into system"
            ImageIndex      =   1
         EndProperty
         BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Caption         =   "Logout "
            Object.ToolTipText     =   "Logout/Logoff"
            ImageIndex      =   10
         EndProperty
         BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Caption         =   "-"
            Style           =   4
         EndProperty
         BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Caption         =   "Invoice Creation "
            Object.ToolTipText     =   "Create an invoice"
            ImageIndex      =   2
         EndProperty
         BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Object.Visible         =   0   'False
            Caption         =   "Receipt Creation"
            Object.ToolTipText     =   "Create a receipt"
            ImageIndex      =   3
         EndProperty
         BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Caption         =   "Money Exchange"
            ImageIndex      =   4
         EndProperty
         BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Caption         =   "-"
            Style           =   3
         EndProperty
         BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Caption         =   "Budget flow"
            ImageIndex      =   5
         EndProperty
         BeginProperty Button9 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Caption         =   "Report"
            ImageIndex      =   6
            Style           =   5
            BeginProperty ButtonMenus {66833FEC-8583-11D1-B16A-00C0F0283628} 
               NumButtonMenus  =   10
               BeginProperty ButtonMenu1 {66833FEE-8583-11D1-B16A-00C0F0283628} 
                  Text            =   "Cash Flow by office"
               EndProperty
               BeginProperty ButtonMenu2 {66833FEE-8583-11D1-B16A-00C0F0283628} 
                  Text            =   "Cash Flow for gindo"
               EndProperty
               BeginProperty ButtonMenu3 {66833FEE-8583-11D1-B16A-00C0F0283628} 
                  Text            =   "Expenditure Report by office"
               EndProperty
               BeginProperty ButtonMenu4 {66833FEE-8583-11D1-B16A-00C0F0283628} 
                  Text            =   "Expenditure Report for gindo"
               EndProperty
               BeginProperty ButtonMenu5 {66833FEE-8583-11D1-B16A-00C0F0283628} 
                  Text            =   "Update Monthly Estimated Expenditure "
               EndProperty
               BeginProperty ButtonMenu6 {66833FEE-8583-11D1-B16A-00C0F0283628} 
                  Text            =   "Compare Monthly Actual && Estimated Expenditure"
               EndProperty
               BeginProperty ButtonMenu7 {66833FEE-8583-11D1-B16A-00C0F0283628} 
                  Text            =   "Report by order"
               EndProperty
               BeginProperty ButtonMenu8 {66833FEE-8583-11D1-B16A-00C0F0283628} 
                  Text            =   "Revenue report"
               EndProperty
               BeginProperty ButtonMenu9 {66833FEE-8583-11D1-B16A-00C0F0283628} 
                  Text            =   "Payment for outside report"
               EndProperty
               BeginProperty ButtonMenu10 {66833FEE-8583-11D1-B16A-00C0F0283628} 
                  Text            =   "Expenditure statistic"
               EndProperty
            EndProperty
         EndProperty
         BeginProperty Button10 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Caption         =   "-"
            Style           =   3
         EndProperty
         BeginProperty Button11 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Caption         =   "Search"
            ImageIndex      =   7
         EndProperty
         BeginProperty Button12 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Caption         =   "Exit"
            ImageIndex      =   8
         EndProperty
         BeginProperty Button13 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Caption         =   "Help"
            ImageIndex      =   9
         EndProperty
      EndProperty
   End
   Begin ctlToolBar.xMenu xMenu1 
      Align           =   1  'Align Top
      Height          =   375
      Left            =   0
      TabIndex        =   0
      Top             =   0
      Width           =   13245
      _ExtentX        =   23363
      _ExtentY        =   661
      ItemCount       =   58
      BeginProperty ItemsFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      MenuCaption1    =   "System"
      MenuName1       =   "mnuSystem"
      MenuDescription1=   "Menu system"
      MenuIdent2      =   1
      MenuCaption2    =   "Login"
      MenuName2       =   "mnulogin"
      MenuPicture2    =   "MDIForm1.frx":1612F
      MenuIdent3      =   1
      MenuCaption3    =   "Logout"
      MenuName3       =   "mnuLogout"
      MenuPicture3    =   "MDIForm1.frx":164F5
      MenuIdent4      =   1
      MenuCaption4    =   "Users"
      MenuName4       =   "mnuUser"
      MenuIdent5      =   1
      MenuCaption5    =   "-"
      MenuName5       =   "MenuSeperate1"
      MenuIdent6      =   1
      MenuCaption6    =   "Import data from file"
      MenuName6       =   "mnuImport"
      MenuPicture6    =   "MDIForm1.frx":168BB
      MenuIdent7      =   1
      MenuCaption7    =   "Import data from web"
      MenuName7       =   "mnuImportAlldatafromWeb"
      MenuEnabled8    =   0   'False
      MenuIdent8      =   1
      MenuCaption8    =   "Import approved data from file"
      MenuName8       =   "ImportApproved"
      MenuIdent9      =   1
      MenuCaption9    =   "Import approved data from web"
      MenuName9       =   "menuImportapprovedFromWeb"
      MenuIdent10     =   1
      MenuCaption10   =   "-"
      MenuName10      =   "MenuSeperate2"
      MenuIdent11     =   1
      MenuCaption11   =   "Export data to file (for GM, MAC)"
      MenuName11      =   "mnuExport"
      MenuPicture11   =   "MDIForm1.frx":16C81
      MenuIdent12     =   1
      MenuCaption12   =   "Export data to web for GM"
      MenuName12      =   "mnuExporttoWebforGM"
      MenuIdent13     =   1
      MenuCaption13   =   "Export data to web for MAC"
      MenuName13      =   "mnuExporttoWebforMAC"
      MenuEnabled14   =   0   'False
      MenuIdent14     =   1
      MenuCaption14   =   "Export approved data to file"
      MenuName14      =   "ExportApproved"
      MenuIdent15     =   1
      MenuCaption15   =   "Export approved data to web"
      MenuName15      =   "ExportApprovedtoWeb"
      MenuIdent16     =   1
      MenuCaption16   =   "-"
      MenuName16      =   "MenuSeperate3"
      MenuIdent17     =   1
      MenuCaption17   =   "Type managerment"
      MenuName17      =   "TypeManagerment"
      MenuIdent18     =   1
      MenuCaption18   =   "Data backup and configuration"
      MenuName18      =   "mnuBackup"
      MenuPicture18   =   "MDIForm1.frx":17047
      MenuIdent19     =   1
      MenuCaption19   =   "E-mail Option"
      MenuName19      =   "mnuEmailOption"
      MenuPicture19   =   "MDIForm1.frx":17399
      MenuIdent20     =   1
      MenuCaption20   =   "FTP Connection details"
      MenuName20      =   "mnuFTP"
      MenuPicture20   =   "MDIForm1.frx":176EB
      MenuCaption21   =   "Input"
      MenuName21      =   "mnuInput"
      MenuIdent22     =   1
      MenuCaption22   =   "Invoice Creation"
      MenuName22      =   "mnuinvoice1"
      MenuIdent23     =   2
      MenuCaption23   =   "Invoice"
      MenuName23      =   "mnuinvoice"
      MenuIdent24     =   2
      MenuCaption24   =   "Temporary Invoice"
      MenuName24      =   "mnuTInvoice"
      MenuIdent25     =   1
      MenuCaption25   =   "Revenue Creation"
      MenuName25      =   "mnuReciept1"
      MenuIdent26     =   2
      MenuCaption26   =   "Revenue"
      MenuName26      =   "mnuReciept"
      MenuIdent27     =   2
      MenuCaption27   =   "Temporary Receipt"
      MenuName27      =   "mnuTReceipt"
      MenuIdent28     =   1
      MenuCaption28   =   "Money Exchange"
      MenuName28      =   "mnuME"
      MenuPicture28   =   "MDIForm1.frx":17A3D
      MenuIdent29     =   1
      MenuCaption29   =   "Cash && Bank Transfer"
      MenuName29      =   "mnuCBT"
      MenuIdent30     =   1
      MenuCaption30   =   "Budget Flow"
      MenuName30      =   "mnuBflow"
      MenuPicture30   =   "MDIForm1.frx":17E03
      MenuIdent31     =   1
      MenuCaption31   =   "ROE Management"
      MenuName31      =   "mnuROE"
      MenuIdent32     =   1
      MenuCaption32   =   "Balance Management"
      MenuName32      =   "mnuBM"
      MenuPicture32   =   "MDIForm1.frx":181C9
      MenuIdent33     =   1
      MenuCaption33   =   "-"
      MenuName33      =   "mnuSep5"
      MenuIdent34     =   1
      MenuCaption34   =   "Update Monthly Estimated Expenditure "
      MenuName34      =   "mnuUpdateEstimated"
      MenuIdent35     =   1
      MenuCaption35   =   "Update Yearly Financial Plan"
      MenuName35      =   "mnuUpdateYearlyPlan"
      MenuIdent36     =   1
      MenuCaption36   =   "-"
      MenuName36      =   "mnuSep6"
      MenuIdent37     =   1
      MenuCaption37   =   "Search"
      MenuName37      =   "mnuSearch"
      MenuPicture37   =   "MDIForm1.frx":1858F
      MenuCaption38   =   "Report"
      MenuName38      =   "mnuReport"
      MenuIdent39     =   1
      MenuCaption39   =   "Cash Flow by office"
      MenuName39      =   "mnuCF"
      MenuPicture39   =   "MDIForm1.frx":18961
      MenuIdent40     =   1
      MenuCaption40   =   "Cash Flow for Gindo"
      MenuName40      =   "mnuGCF"
      MenuIdent41     =   1
      MenuCaption41   =   "-"
      MenuName41      =   "mnuSep8"
      MenuIdent42     =   1
      MenuCaption42   =   "Expenditure Report by office"
      MenuName42      =   "mnuER"
      MenuPicture42   =   "MDIForm1.frx":18CB3
      MenuIdent43     =   1
      MenuCaption43   =   "Expenditure report for Gindo"
      MenuName43      =   "mnuGER"
      MenuIdent44     =   1
      MenuCaption44   =   "Expenditure statistic"
      MenuName44      =   "mnuStatisticReport"
      MenuIdent45     =   1
      MenuCaption45   =   "-"
      MenuName45      =   "mnuSep9"
      MenuIdent46     =   1
      MenuCaption46   =   "Budget Summary"
      MenuName46      =   "mnuBS"
      MenuPicture46   =   "MDIForm1.frx":190BD
      MenuVisible46   =   0   'False
      MenuIdent47     =   1
      MenuCaption47   =   "Gindo Budget Summary"
      MenuName47      =   "mnuGBS"
      MenuVisible47   =   0   'False
      MenuIdent48     =   1
      MenuCaption48   =   "Compare Monthly Actual && Estimated Expenditure"
      MenuName48      =   "mnuCompareActualEstimated"
      MenuIdent49     =   1
      MenuCaption49   =   "Report by order"
      MenuName49      =   "mnuCustomReport"
      MenuIdent50     =   1
      MenuCaption50   =   "Revenue report"
      MenuName50      =   "mnuReceiptReport"
      MenuIdent51     =   1
      MenuCaption51   =   "Payment for outside report"
      MenuName51      =   "mnuPayforOutsite"
      MenuCaption52   =   "Help"
      MenuName52      =   "mnuHelp"
      MenuIdent53     =   1
      MenuCaption53   =   "Index ..."
      MenuName53      =   "mnuIndex"
      MenuPicture53   =   "MDIForm1.frx":19483
      MenuIdent54     =   1
      MenuCaption54   =   "Online help"
      MenuName54      =   "mnucontent"
      MenuIdent55     =   1
      MenuCaption55   =   "-"
      MenuName55      =   "mnuSep3"
      MenuIdent56     =   1
      MenuCaption56   =   "Check & for Updates..."
      MenuName56      =   "mnuLiveUpdate"
      MenuIdent57     =   1
      MenuCaption57   =   "-"
      MenuName57      =   "mnuSep4"
      MenuIdent58     =   1
      MenuCaption58   =   "About accounting software"
      MenuName58      =   "mnuAbout"
   End
   Begin MyXPMenu6.MyXPMenu MyXPMenu1 
      Left            =   1200
      Top             =   4800
      _ExtentX        =   900
      _ExtentY        =   900
      BmpCount        =   0
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
   End
End
Attribute VB_Name = "MDIForm1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim WinHTTPReq As Object 'declare object to load background
Dim ntime As Integer

Dim hOpen As Long, hConnection As Long, hFile As Long
Dim dwType As Long
Dim dwSeman As Long
'''
'''Dim ftpHostname As String
'''Dim ftpUsername As String
'''Dim ftpPassword As String
'''Dim ftpremoteFolder As String
Dim fileUpload As String

Private WithEvents poSendMail As clsSendMail
Attribute poSendMail.VB_VarHelpID = -1

Private Sub MDIForm_Load()
    Call loadUrlPicture
    
    ReadFTPSetting (App.Path & "\FTPSetting.ini")
    
    currVer = App.Major & "." & App.Minor & "." & App.Revision
    verdate = "03:15:27 PM, 24/03/2011"

    staruptime
    
    WriteCurrentVersionToFile (currVer)
    stroffice = getOffice
    Call disableMenuNToolbar(True)
    path_fileExport = ""
    frmExportApproved.WhoCall = ""
    officeBImport = ""
    
    Set poSendMail = New clsSendMail
    ReadTextFile (App.Path & "\mailer.ini")
    subeaEmailCC
    eaok = True ' default = true
End Sub

Private Sub MDIForm_QueryUnload(Cancel As Integer, UnloadMode As Integer)
    On Error Resume Next
    ApExcel.Quit
    Set ApExcel = Nothing
    End
End Sub

Private Sub MDIForm_Terminate()
    On Error Resume Next
    ApExcel.Quit
    Set ApExcel = Nothing
End Sub

Private Sub MDIForm_Unload(Cancel As Integer)
    On Error Resume Next
    ApExcel.Quit
    Set ApExcel = Nothing
    Set poSendMail = Nothing
End Sub

Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
    Select Case Button.index
        Case 1
            frmLogin.Show
        Case 2
           If MsgBox("Do you want to logout? (Y/N)", vbYesNo + vbQuestion) = vbYes Then
                OKPass = False
                
                Call disableAllMenuToolbar
                
                MDIForm1.Toolbar1.buttons(1).Enabled = True
                MDIForm1.xMenu1.MenuTree.item(2).Enabled = True
                MDIForm1.xMenu1.MenuTree.item(7).Enabled = False
                MDIForm1.xMenu1.MenuTree.item(8).Enabled = False
                xMenu1.MenuTree.item(26).Enabled = False
                xMenu1.MenuTree.item(28).Enabled = False
                Toolbar1.buttons(9).ButtonMenus(2).Enabled = False
                Toolbar1.buttons(9).ButtonMenus(4).Enabled = False
                MDIForm1.xMenu1.Refresh
                MDIForm1.Toolbar1.Refresh
           End If
        Case 4
            frmIncoice.lblTitle = "INVOICE"
            frmIncoice.txtBillType.Text = "IV"
            frmIncoice.Label1(0).Caption = "Office"
            
            Call SetOffcValue(frmIncoice.cmbOFFC, "IV")
            
            Call frmIncoice.CreatIDNumber
            
            frmIncoice.cmdAddType.Enabled = True
    
        Case 5
            frmIncoice.lblTitle = "RECEIPT"
            frmIncoice.txtBillType.Text = "RC"
            frmIncoice.Label1(0).Caption = "Source"
            
            Call SetOffcValue(frmIncoice.cmbOFFC, "RC")
            Call frmIncoice.CreatIDNumber
            
            frmIncoice.cmdAddType.Enabled = False
            frmIncoice.lblFinancial.Visible = True
            frmIncoice.cboFinancial.Visible = True
        Case 6
            frmME.Show
            'Call frmME.Move(0, 0)
            frmME.ZOrder (0)
            frmME.BorderStyle = 0
            frmME.lblTitle = "Money Exchange"
            frmME.txtBillType.Text = "ME"
        Case 8
            frmIncoice.lblTitle = "BUDGET FLOW"
            frmIncoice.txtBillType.Text = "BF"
            frmIncoice.Label1(0).Caption = "Office"
            
            Call SetOffcValue(frmIncoice.cmbOFFC, "BF")
            Call frmIncoice.CreatIDNumber
            
            frmIncoice.cmdAddType.Enabled = False
            frmIncoice.Label13.Visible = True
            frmIncoice.Label14.Visible = True
            frmIncoice.cboFrom.Visible = True
            frmIncoice.cboTo.Visible = True
        Case 9
    '        Load frmReport
    '        frmReport.Show
            Load frmReportNenu
            frmReportNenu.Show
    
        Case 11
            frmSearch.Show
            frmSearch.lblTitle = "SEARCH"
        Case 12
            If MsgBox("Do you want to exit? (Y/N)", vbYesNo + vbQuestion) = vbYes Then
                Dim frm As Form
    
                For Each frm In Forms
                    Unload frm
                    Set frm = Nothing
                Next
               
                End
            End If
        Case 13
            MsgBox "Help...", vbMsgBoxHelpButton, "Accountant"
    End Select
End Sub

Private Sub Toolbar1_ButtonMenuClick(ByVal ButtonMenu As MSComctlLib.ButtonMenu)
    Select Case ButtonMenu.index
        Case 1
             Load frmsubreport1
             frmsubreport1.Show
             frmsubreport1.Command1.Tag = "CF"
             frmsubreport1.Caption = "Cf Report by office"
             'frmsubreport2.cboOffice2.Enabled = True
            'Load frmReport
            'frmReport.Show
        Case 2
             Load frmsubreport1
             frmsubreport1.Show
             frmsubreport1.Command1.Tag = "GCF"
             frmsubreport1.cboOffice.Enabled = False
             frmsubreport1.Caption = "Cf Report for gindo"
             'frmsubreport2.cboOffice2.Enabled = False
        Case 3
             Load frmsubreport2
             frmsubreport2.Show
             frmsubreport2.Command1.Tag = "ER"
             frmsubreport2.Caption = "Expenditure Report by office"
             'frmsubreport2.cboOffice2.Enabled = True
        Case 4
             Load frmsubreport2
             frmsubreport2.Show
             frmsubreport2.Command1.Tag = "GER"
             frmsubreport2.Caption = "Expenditure Report for Gindo"
             frmsubreport2.cboOffice.Enabled = False
        Case 5
             frmEstimatedExp.Show
        Case 6
             Load frmsubreport1
             frmsubreport1.Show
             frmsubreport1.Command1.Tag = "ESTIMATED"
             frmsubreport1.Caption = "Estimated expenditure Report"
             frmsubreport1.cboOffice.AddItem "GINDO"
        Case 7
             frmCustom.Show
        Case 8
             frmReceiptReport.Show
        Case 9
             frmPayForReport.Show
        Case 10
             frmsubreport3.Show
    End Select
End Sub

Private Sub xMenu1_ItemClick(Key As String)
    ShowForm Key
End Sub

Private Function ShowForm(Key As String)
    Select Case Key
        Case "mnuStatisticReport"
            frmsubreport3.Show
            
        Case "mnuUpdateEstimated"
            frmEstimatedExp.Show
            
        Case "mnuUpdateYearlyPlan"
            frmEstimatedExpYearly.Show
            
        Case "mnuCompareActualEstimated"
            'MsgBox "There is no data", vbCritical + vbOKOnly, "Accounting"
            Load frmsubreport1
            frmsubreport1.Show
            frmsubreport1.Command1.Tag = "ESTIMATED"
            ' frmsubreport1.cboOffice.Enabled = False
            frmsubreport1.Caption = "Estimated expenditure Report"
            frmsubreport1.cboOffice.AddItem "GINDO"
            
        Case "mnuBackup"
            frmAutoBackup.Show
        Case "mnuEmailOption"
            frmOptionEmail.Show
        Case "mnuFTP"
            frmFTPdetail.Show
        
        Case "ExportApproved"
            frmExportApproved.WhoCall = "ExporttoFile"
            frmExportApproved.Show
            
            
        Case "ExportApprovedtoWeb"
            import_export = ""
            frmExportApproved.WhoCall = "ExporttoWebforGM"
            frmExportApproved.Show
            
        Case "ImportApproved"
            frmExportApproved.WhoCall = "ImportfromFile"
            frmExportApproved.Show
            
            '''''========================
            
        Case "mnuImportAlldatafromWeb"
            frmExportApproved.WhoCall = "ImportAllfilefromWeb"
            import_export = "ImportAllfilefromWeb"
            Call connectURL
            If hConnection <> 0 Then
                Call ImportAllData
            End If
            
        Case "mnuImport"
            officeBImport = "" 'import all file named: [office]_exportdata.dat
            Call ImportAllData
            '''''========================
            
        Case "menuImportapprovedFromWeb"
            import_export = ""
            frmExportApproved.WhoCall = "ImportfromWeb"
            'import_export = "menuImportapprovedFromWeb"
            path_fileExport = "Approved_data_for_" & stroffice & ".rar"
            Call connectURL
            
            
        Case "mnuLiveUpdate"
            WriteCurrentVersionToFile (currVer)
            Shell App.Path & "\liveupd.exe", vbNormalFocus
            End 'unload MDIForm1
            
        Case "mnuAbout"
            frmAbout.Show
            
        Case "mnuCustomReport"
            frmCustom.Show
        Case "mnuPayforOutsite"
            frmPayForReport.Show
        Case "mnuReceiptReport"
            frmReceiptReport.Show
        Case "mnuSearch"
            frmSearch.Show
            frmSearch.lblTitle = "SEARCH"
        Case "TypeManagerment"
            frmNewType.isSelect = False
            frmNewType.Show
            

            
        Case "mnuExport"
            Call exportData
            MsgBox "Data exported successfully to folder EXPORT"
 '=========================================================
        'Accounting export to MAC
        Case "mnuExporttoWebforMAC"
            import_export = ""
            eaEmailSendto = "finance@galileovietnam.com"
            frmExportApproved.WhoCall = "ExporttoWebforMAC"
            Call exportData
            Call connectURL
        
        
 '=========================================================
        'Accounting export to GM
        Case "mnuExporttoWebforGM"
            import_export = ""
            eaEmailSendto = "long.nguyen@galileovietnam.com"
            frmExportApproved.WhoCall = "ExporttoWebforGM"
            Call exportData
            Call connectURL
            
        Case "mnulogin"
            frmLogin.Show
        Case "mnuUser"
            If Not isLoged Then
                Exit Function
            End If
            If permit = "U" Or permit = "R" Then
                Call KetNoi
                frmChgPass.Username = CurrentUser
                frmChgPass.Show
                'Call DisconnectBo
                Exit Function
            End If
            frmUserManager.Show
        Case "mnuLogout"
            Dim I As Integer
            If MsgBox("Do you want to logout? (Y/N)", vbYesNo + vbQuestion) = vbYes Then
                OKPass = False

                Call disableAllMenuToolbar

                '''''''''Call disableMenuNToolbar(True)
                MDIForm1.Toolbar1.buttons(1).Enabled = True
                MDIForm1.xMenu1.MenuTree.item(2).Enabled = True
                MDIForm1.xMenu1.MenuTree.item(7).Enabled = False
                MDIForm1.xMenu1.MenuTree.item(8).Enabled = False
                MDIForm1.xMenu1.Refresh
                MDIForm1.Toolbar1.Refresh
            End If
        Case "mnuinvoice"
            frmIncoice.lblTitle = "INVOICE"
            frmIncoice.txtBillType.Text = "IV"
            frmIncoice.Label1(0).Caption = "Offc"
            Call SetOffcValue(frmIncoice.cmbOFFC, "IV")
            Call frmIncoice.CreatIDNumber
            frmIncoice.cmdAddType.Enabled = True
          
        Case "mnuReciept"
            frmIncoice.lblTitle = "REVENUE" '"RECEIPT"
            frmIncoice.txtBillType.Text = "RC"
            frmIncoice.Label1(0).Caption = "Source"
            Call SetOffcValue(frmIncoice.cmbOFFC, "RC")
            Call frmIncoice.CreatIDNumber
            frmIncoice.cmdAddType.Enabled = False
            frmIncoice.lblFinancial.Visible = True
            frmIncoice.cboFinancial.Visible = True
        Case "mnuME"
            frmME.Show
            Call frmME.Move(0, 0)
            frmME.ZOrder (0)
            frmME.BorderStyle = 0
            frmME.lblTitle = "Money Exchange"
            frmME.txtBillType.Text = "ME"
        Case "mnuCBT"
            frmCBT.Show
            'Call frmCBT.Move(0, 0)
            frmCBT.ZOrder (0)
            frmCBT.BorderStyle = 0
            'frmCBT.lblTitle = "Transfer"
            frmCBT.txtBillType.Text = "TRANSFER"
                       
        Case "mnuBflow"
            frmIncoice.lblTitle = "BUDGET FLOW"
            frmIncoice.txtBillType.Text = "BF"
            frmIncoice.Label1(0).Caption = "Office"
            Call SetOffcValue(frmIncoice.cmbOFFC, "BF")
            Call frmIncoice.CreatIDNumber
            frmIncoice.cmdAddType.Enabled = False
        Case "mnuTInvoice"
            frmIncoice.lblTitle = "TEMPORARY INVOICE"
            frmIncoice.txtBillType.Text = "TI"
            frmIncoice.Label1(0).Caption = "Office"
            Call SetOffcValue(frmIncoice.cmbOFFC, "TI")
            Call frmIncoice.CreatIDNumber
            frmIncoice.cmdAddType.Enabled = True
        Case "mnuTReceipt"
            frmIncoice.lblTitle = "TEMPORARY RECEIPT"
            frmIncoice.txtBillType.Text = "TR"
            frmIncoice.Label1(0).Caption = "Office"
            Call SetOffcValue(frmIncoice.cmbOFFC, "TR")
            Call frmIncoice.CreatIDNumber
            frmIncoice.cmdAddType.Enabled = False
        Case "mnuROE"
            Load frmROE
            frmROE.Show
        Case "mnuBM"
            Load frmBalance
            frmBalance.Show
        Case "mnuBS"
            frmReport.Show
            'FRMrEPORT.lblTitle = "REPORT"
        Case "mnuGBS"
            Load frmReport
            frmReport.Show
        Case "mnuCF"
            Load frmsubreport1
            frmsubreport1.Show
            frmsubreport1.Command1.Tag = "CF"
            frmsubreport1.Caption = "Cf Report by office"
            'Load frmReport
            'frmReport.Show
        Case "mnuGCF"
            Load frmsubreport1
            frmsubreport1.Show
            frmsubreport1.Command1.Tag = "GCF"
            frmsubreport1.cboOffice.Enabled = False
            frmsubreport1.Caption = "Cf Report for gindo"
        Case "mnuER"
            Load frmsubreport2
            frmsubreport2.Show
            frmsubreport2.Command1.Tag = "ER"
            frmsubreport2.Caption = "Expenditure Report by office"
        Case "mnuGER"
            Load frmsubreport2
            frmsubreport2.Show
            frmsubreport2.Command1.Tag = "GER"
            frmsubreport2.Caption = "Expenditure Report for Gindo"
            frmsubreport2.cboOffice.Enabled = False
    ''        frmsubreport2.cboOffice.Enabled = False
    ''        frmsubreport2.Frame1.Visible = False
    ''        frmsubreport2.Frame2.Visible = True
    ''        frmsubreport2.Frame2.Top = frmsubreport2.Frame1.Top
    ''        frmsubreport2.Frame2.Left = frmsubreport2.Frame1.Left
        Case "mnuIndex", "mnucontent"
            Shell "C:\Program Files\Internet Explorer\IEXPLORE.EXE" & Space(1) & App.Path & "\help\help.htm", vbNormalFocus
    End Select

End Function

Public Sub disableAllMenuToolbar()
    Dim I As Integer

    For I = 2 To 11
        MDIForm1.Toolbar1.buttons(I).Enabled = False
    Next I
    'Disable xMenu:
    For I = 3 To 50
        MDIForm1.xMenu1.MenuTree.item(I).Enabled = False
    Next I
End Sub

Public Function disableMenuNToolbar(isDisable As Boolean)
    Dim I As Integer
    'disable toolbar: logout, Invoice Creation, Money Exchange, Budget flow, Report, Search, Exit
    For I = 2 To 11
        MDIForm1.Toolbar1.buttons(I).Enabled = Not isDisable
    Next I
    'Disable xMenu:
    For I = 3 To 50
        MDIForm1.xMenu1.MenuTree.item(I).Enabled = Not isDisable
    Next I
    

    If permit <> "G" And permit <> "B" And permit <> "" Then
        xMenu1.MenuTree.item(6).Enabled = False 'import data from file
        xMenu1.MenuTree.item(7).Enabled = False 'import data from web
        
        xMenu1.MenuTree.item(8).Enabled = True 'import approved data from file
        xMenu1.MenuTree.item(9).Enabled = True 'import approved data from web
        
        xMenu1.MenuTree.item(11).Enabled = True 'Export data to file
        xMenu1.MenuTree.item(12).Enabled = True 'Export data to web for GM
        xMenu1.MenuTree.item(13).Enabled = True 'Export data to web for MAC
        
        xMenu1.MenuTree.item(14).Enabled = False 'Export approved data to file
        xMenu1.MenuTree.item(15).Enabled = False 'Export approved data to web
        
    ElseIf permit = "G" And permit <> "" Then
        xMenu1.MenuTree.item(6).Enabled = True 'import data from file
        xMenu1.MenuTree.item(7).Enabled = True 'import data from web
        
        xMenu1.MenuTree.item(8).Enabled = False 'import approved data from file
        xMenu1.MenuTree.item(9).Enabled = False 'import approved data from web

        xMenu1.MenuTree.item(11).Enabled = False 'Export data to file
        xMenu1.MenuTree.item(12).Enabled = False 'Export data to web for GM
        xMenu1.MenuTree.item(13).Enabled = False 'Export data to web for MAC

        xMenu1.MenuTree.item(14).Enabled = True 'Export approved data to file
        xMenu1.MenuTree.item(15).Enabled = True 'Export approved data to web
        
    ElseIf permit = "B" And permit <> "" Then
        xMenu1.MenuTree.item(6).Enabled = True 'import data from file
        xMenu1.MenuTree.item(7).Enabled = True 'import data from web (all offices)
        
        xMenu1.MenuTree.item(8).Enabled = True 'import approved data from file
        xMenu1.MenuTree.item(9).Enabled = True 'import approved data from web

        xMenu1.MenuTree.item(11).Enabled = True 'Export data to file
        xMenu1.MenuTree.item(12).Enabled = True 'Export data to web for GM
        xMenu1.MenuTree.item(13).Enabled = False 'Export data to web for MAC

        xMenu1.MenuTree.item(14).Enabled = False 'Export approved data to file
        xMenu1.MenuTree.item(15).Enabled = False 'Export approved data to web
    End If
    ''=====================
    If permit = "G" Or permit = "B" Or permit = "A" Then
        xMenu1.MenuTree.item(40).Enabled = True 'Cash Flow for gindo
        xMenu1.MenuTree.item(43).Enabled = True 'Expenditure Report for gindo
        Toolbar1.buttons(9).ButtonMenus(2).Enabled = True 'Report, Cash Flow for gindo
        Toolbar1.buttons(9).ButtonMenus(4).Enabled = True 'Report, Expenditure Report for gindo
    Else
        xMenu1.MenuTree.item(40).Enabled = False 'Cash Flow for gindo
        xMenu1.MenuTree.item(43).Enabled = False 'Expenditure Report for gindo
        Toolbar1.buttons(9).ButtonMenus(2).Enabled = False 'Report, Cash Flow for gindo
        Toolbar1.buttons(9).ButtonMenus(4).Enabled = False 'Report, Expenditure Report for gindo
    End If
    
    'ExportApproved
    MDIForm1.Toolbar1.Refresh
    MDIForm1.xMenu1.Refresh
End Function



''Dir
Private Sub GetAllFiles()
    Dim szDir As String
    Dim hFind As Long
    Dim nLastError As Long
    Dim dError As Long
    Dim ptr As Long
    Dim pData As WIN32_FIND_DATA
    If officeBImport = "" Then
        hFind = FtpFindFirstFile(hConnection, ftpremoteFolder & "\" & "*" & "_exportdata.rar", pData, 0, 0)
    Else
        hFind = FtpFindFirstFile(hConnection, ftpremoteFolder & "\" & "*" & "_" & officeBImport & "exportdata.rar", pData, 0, 0)
    End If
    
    nLastError = err.LastDllError
    If hFind = 0 Then
        If (nLastError = ERROR_NO_MORE_FILES) Then
            'MsgBox "No files!", vbInformation, "Galileo Import"
            Exit Sub
        Else
            ErrorOut err.LastDllError, "FtpFindFirstFile"
        End If
        'Exit Sub
    End If

    dError = NO_ERROR
    Dim bRet As Boolean

    szDir = Left(pData.cFileName, InStr(1, pData.cFileName, String(1, 0), vbBinaryCompare) - 1) '& " " & Win32ToVbTime(pData.ftLastWriteTime)
    fileUpload = szDir
'''    stroffice = Left(fileUpload, 3)
    Call GetFile
    Do
        pData.cFileName = String(MAX_PATH, 0)
        bRet = InternetFindNextFile(hFind, pData)
        If Not bRet Then
            dError = err.LastDllError
            If dError = ERROR_NO_MORE_FILES Then
                Exit Do
            Else
                ErrorOut err.LastDllError, "InternetFindNextFile"
                InternetCloseHandle (hFind)
                Exit Sub
            End If
        Else

            szDir = Left(pData.cFileName, InStr(1, pData.cFileName, String(1, 0), vbBinaryCompare) - 1) '& " " & Win32ToVbTime(pData.ftLastWriteTime) & vbCrLf
            fileUpload = szDir
            Call GetFile
        End If
    Loop

    Dim szTemp As String
    szTemp = String(1024, Chr$(0))
    If (FtpGetCurrentDirectory(hConnection, szTemp, 1024) = False) Then
        ErrorOut err.LastDllError, "FtpGetCurrentDirectory"
        Exit Sub
    End If
    'MsgBox szDir, , "Directory Listing of: " & szTemp
    InternetCloseHandle (hFind)
End Sub




Public Sub connectURL()
    'ftpHostname = "127.0.0.1"
    'ReadFTPSetting (App.Path & "\FTPSetting.ini")
'''    ftpHostname = "69.49.230.164"
'''    ftpUsername = "accounting"
'''    ftpPassword = "saigon2a4a"
    fileUpload = path_fileExport
'''    ftpremoteFolder = "down/upload/"

    hOpen = InternetOpen("Galileo FTP", INTERNET_OPEN_TYPE_PRECONFIG, vbNullString, vbNullString, 0)
    If hOpen = 0 Then
        ErrorOut err.LastDllError, "InternetOpen"
        Exit Sub
        ''message here
    End If

    dwType = FTP_TRANSFER_TYPE_ASCII
    dwSeman = 0
    hConnection = 0

    Call Connect               '//Connect

End Sub

Private Sub Connect() 'connect to import or export data
    If hConnection <> 0 Then
        InternetCloseHandle hConnection
    End If
    hConnection = InternetConnect(hOpen, ftpHostname, INTERNET_INVALID_PORT_NUMBER, _
            ftpUsername, ftpPassword, INTERNET_SERVICE_FTP, dwSeman, 0)
    If hConnection = 0 Then
        'ErrorOut err.LastDllError, "InternetConnect"
        MsgBox "The username or password was not allowed for connecting to server, please contact your administrator", vbCritical, "Galileo FTP"
        'MsgBox "Data exported is not successfully to Web", vbCritical
    ElseIf frmExportApproved.WhoCall = "ExporttoWebforGM" Or frmExportApproved.WhoCall = "ExporttoWebforMAC" Then 'import_export = "mnuExporttoWebforGM" Or frmExportApproved.WhoCall = "ExporttoWebforGM" Then
        Call PutFile
    ElseIf frmExportApproved.WhoCall = "ImportfromWeb" Then
        Call GetFile
    ElseIf import_export = "ImportAllfilefromWeb" Then
        Call GetAllFiles
    End If
End Sub


Private Sub Disconnect()
    If hConnection <> 0 Then
        InternetCloseHandle hConnection
    End If
    hConnection = 0
End Sub

Private Sub PutFile()
    ''//this will make full upload path (dir+file)
    Call UpdatePaths
    ' for ASCII files use FTP_TRANSFER_TYPE_ASCII
    If (FtpPutFile(hConnection, fileUpload, ftpremoteFolder, _
            dwType, 0) = False) Then
        ErrorOut err.LastDllError, "Galileo Upload"
        Exit Sub
    Else
        ''''MsgBox "File transfered!", , "Galileo Ftp"
        If eaok = True Then
            Call sendMailTo(esmtp, email, eyourname, "", eaEmailSendto, eaEmailCC, esubject & " -- " & " at time: " & Now, emessage, bAuthLogin, eusername, epassword, 25)
        End If
        MsgBox "Data have been exported to web successfully", vbInformation
        Call Disconnect
    End If
End Sub

Private Sub GetFile()
    ' for ASCII files use FTP_TRANSFER_TYPE_ASCII
    ' add INTERNET_FLAG_NO_CACHE_WRITE to avoid local caching 0x04000000 (hex)
    If (FtpGetFile(hConnection, ftpremoteFolder & fileUpload, App.Path & "\import\" & fileUpload, False, _
            FILE_ATTRIBUTE_NORMAL, dwType Or INTERNET_FLAG_RELOAD, 0) = False) Then
        'ErrorOut err.LastDllError, "Galileo Import"
        If frmExportApproved.WhoCall = "ImportfromWeb" Then
            MsgBox "Not get feedback from GM yet!", vbInformation, "Galileo Import"
            Exit Sub
        End If
    Else
        If frmExportApproved.WhoCall = "ImportfromWeb" Then
            Call DeleteFile 'dung cho MAC: khong delete file tren server
            
            Call ZipFile(App.Path & "\Import\" & path_fileExport, App.Path & "\import\", True, " x -ep ", False, "")
            'change extension file .rar to .dat for importing data
            path_fileExport = Replace(path_fileExport, ".rar", ".dat")
            frmExportApproved.importapprovedata
            
        ElseIf import_export = "ImportAllfilefromWeb" Then
            Call DeleteFile 'dung cho MAC: khong delete file tren server
            path_fileExport = fileUpload
            Call ZipFile(App.Path & "\Import\" & path_fileExport, App.Path & "\import\", True, " x -ep ", False, "")
            'change extension file .rar to .dat for importing data
            path_fileExport = Replace(path_fileExport, ".rar", ".dat")

''''            Call ImportAllData
        End If
    End If
End Sub

Private Sub DeleteFile()
    If (FtpDeleteFile(hConnection, ftpremoteFolder & fileUpload) = False) Then
        MsgBox "FtpDeleteFile error: " & err.LastDllError
        Exit Sub
    End If
End Sub

Private Sub ErrorOut(ByVal dwError As Long, ByRef szFunc As String)
    Dim dwRet As Long
    Dim dwTemp As Long
    Dim szString As String * 2048
    Dim szErrorMessage As String
    dwRet = FormatMessage(FORMAT_MESSAGE_FROM_HMODULE, _
            GetModuleHandle("wininet.dll"), dwError, 0, _
            szString, 256, 0)
    szErrorMessage = szFunc & " error code: " & dwError & " Message: " & szString
    Debug.Print szErrorMessage
    MsgBox szErrorMessage, , "Galileo Ftp"
    If (dwError = 12003) Then
        ' Extended error information was returned
        dwRet = InternetGetLastResponseInfo(dwTemp, szString, 2048)
       Debug.Print szString
    End If
End Sub

Sub UpdatePaths()
    Dim pos, filenameonly

    pos = InStr(1, StrReverse(fileUpload), "\")
    If pos = 0 Then pos = InStr(1, StrReverse(fileUpload), "/")
    If pos Then filenameonly = Mid(fileUpload, Len(fileUpload) - pos + 2, 255)

    pos = InStr(1, StrReverse(ftpremoteFolder), "\")
    If pos = 0 Then pos = InStr(1, StrReverse(ftpremoteFolder), "/")
    If Len(ftpremoteFolder) - pos > 0 Then
        ftpremoteFolder = Left(ftpremoteFolder, Len(ftpremoteFolder) - pos + 1)
    End If

    If Right(Trim(ftpremoteFolder), 1) = "\" Or Right(Trim(ftpremoteFolder), 1) = "/" Then
        ftpremoteFolder = ftpremoteFolder & filenameonly
    Else
        ftpremoteFolder = ftpremoteFolder & "/" & filenameonly
    End If
End Sub
'''----------------------------------

Private Sub loadUrlPicture()
    On Error GoTo errorUrlPicture
    ' myLayout.SetLayout Me
    Dim numberPicture As Integer
    Dim namePicture As String
    Dim urlPicture As String

    Randomize
    numberPicture = Rnd(1) * 40
    namePicture = numberPicture & ".jpg"

    'urlPicture = "http://server/pic/" & namePicture
    urlPicture = "http://www.galileo.com.vn/down/pics/" & namePicture
    Set WinHTTPReq = CreateObject("WinHttp.WinHttpRequest.5.1")

    Dim d() As Byte
    WinHTTPReq.Open "GET", urlPicture, False  ' Send the HTTP Request.
    WinHTTPReq.Send
    Debug.Print WinHTTPReq.Status & " - " & WinHTTPReq.statusText '200 means success

    Open "temp.jpg" For Binary As #1
        d() = WinHTTPReq.responseBody
        Put #1, 1, d()
    Close

    Me.Picture = LoadPicture("temp.jpg")

    Set WinHTTPReq = Nothing
errorUrlPicture:
    'On Error GoTo errorUrlPicture2
        'Me.Picture = LoadPicture(App.Path & "/temp.jpg")

'errorUrlPicture2:
    Timer1.Enabled = False
    
    'Change/Refresh Picture property of an MDI Form
    If Me.WindowState = 0 Then
        Me.WindowState = 1 'minimized
        Me.WindowState = 2 'normal
    Else
        Me.WindowState = 1
        Me.WindowState = 2 'maximized
    End If
End Sub

Private Sub Timer1_Timer()
    ntime = ntime + 1
    If ntime / 60 >= 1 Then

        Call loadUrlPicture
        ntime = 0
        'Timer1.Enabled = True

    Else:
    End If
End Sub

'============================================================================
Private Sub sendMailTo(ssmtp As String, semail As String, syourname As String, sreceiver As String, sreceiveremail As String, _
    semailcc As String, sSubject As String, smessage As String, sauthen As Boolean, sUsername As String, sPassword As String, _
    sport As Integer)
    Dim stextfooter As String
    Dim stextfooter2 As String
    stextfooter = Chr(13) & Chr(10) & Chr(10) & Chr(10) & Chr(10) & Chr(10) & Chr(10)
    stextfooter2 = "==============================" & Chr(13) & Chr(10) _
    & "Message sent automatically"
    Screen.MousePointer = vbHourglass
    With poSendMail

        ' **************************************************************************
        ' Optional properties for sending email, but these should be set first
        ' if you are going to use them
        ' **************************************************************************

        .SMTPHostValidation = VALIDATE_NONE         ' Optional, default = VALIDATE_HOST_DNS
        .EmailAddressValidation = VALIDATE_SYNTAX   ' Optional, default = VALIDATE_SYNTAX
        .Delimiter = ";"                            ' Optional, default = ";" (semicolon)

        ' **************************************************************************
        ' Basic properties for sending email
        ' **************************************************************************
        .SMTPHost = ssmtp                  ' Required the fist time, optional thereafter
        .from = semail                        ' Required the fist time, optional thereafter
        .FromDisplayName = syourname        ' Optional, saved after first use
        .Recipient = sreceiveremail 'txtTo.Text                     ' Required, separate multiple entries with delimiter character
        .RecipientDisplayName = sreceiver 'txtToName.Text      ' Optional, separate multiple entries with delimiter character
        
        .CcRecipient = semailcc 'txtCc                        ' Optional, separate multiple entries with delimiter character
''''''        .CcDisplayName = txtCcName                  ' Optional, separate multiple entries with delimiter character
''''''        .BccRecipient = txtBcc                      ' Optional, separate multiple entries with delimiter character
''''''        .ReplyToAddress = txtFrom.Text              ' Optional, used when different than 'From' address
        .Subject = sSubject                  ' Optional
        .Message = smessage & stextfooter & stextfooter2                   ' Optional
''''''        .Attachment = Trim(txtAttach.Text)          ' Optional, separate multiple entries with delimiter character

        ' **************************************************************************
        ' Additional Optional properties, use as required by your application / environment
        ' **************************************************************************
'''''''        .AsHTML = bHtml                             ' Optional, default = FALSE, send mail as html or plain text
'''''''        .ContentBase = ""                           ' Optional, default = Null String, reference base for embedded links
'''''''        .EncodeType = MyEncodeType                  ' Optional, default = MIME_ENCODE
'''''''        .Priority = etPriority                      ' Optional, default = PRIORITY_NORMAL
'''''''        .Receipt = bReceipt                         ' Optional, default = FALSE
        .UseAuthentication = sauthen             ' Optional, default = FALSE
'''''''        .UsePopAuthentication = bPopLogin           ' Optional, default = FALSE
        .Username = sUsername                     ' Optional, default = Null String
        .Password = sPassword                    ' Optional, default = Null String, value is NOT saved
'''''''        .POP3Host = txtPopServer
'''''''        .MaxRecipients = 100                        ' Optional, default = 100, recipient count before error is raised
'''''''
        ' **************************************************************************
        ' Advanced Properties, change only if you have a good reason to do so.
        ' **************************************************************************
        ' .ConnectTimeout = 10                      ' Optional, default = 10
        ' .ConnectRetry = 5                         ' Optional, default = 5
        ' .MessageTimeout = 60                      ' Optional, default = 60
        ' .PersistentSettings = True                ' Optional, default = TRUE
        .SMTPPort = sport                         ' Optional, default = 25

        ' **************************************************************************
        ' OK, all of the properties are set, send the email...
        ' **************************************************************************
        ' .Connect                                  ' Optional, use when sending bulk mail
        .Send                                       ' Required
        ' .Disconnect                               ' Optional, use when sending bulk mail
        ssmtp = .SMTPHost                  ' Optional, re-populate the Host in case
                                                    ' MX look up was used to find a host    End With
    End With
    Screen.MousePointer = vbDefault
End Sub
